package WaiBao;

import java.util.Arrays;

public class WangYiXue {
    public static void main(String[] args) {
        String[] name = {"李玖哲(班长)", "李易(副班长)", "小李(学习委员)", "吴亦(组织委员)", "罗翔", "郭敬明", "李大勇", "张大彪", "艾贝拉", "baby", "夏天", "村田",
                "秋季", "冬雪", "李不凡", "张胜天", "李浩晨", "范尼", "梁思涵", "聚乙烯", "赵憾", "冯紫港", "李慧慧", "岚晶", "张浩天", "梅兰芳", "李道文", "关山酒",
                "北海道", "王怡雪(宣传委员)"};//考生本人:王怡雪(宣传委员)
        int[] age = {19, 18, 20, 21, 20, 18, 21, 21, 19, 19, 18, 19, 18, 20, 21, 19, 18, 19, 18, 20, 19, 19, 20, 20, 20, 18, 20, 19, 18, 19};//考生年龄：19

        double[] free1 = {84, 74, 89, 84, 74, 68, 71, 80, 68, 80, 90, 77, 80, 79, 64, 68, 69, 99, 96, 80, 92, 91, 90, 85, 75, 74, 74, 84, 87, 96};
        double[] free2 = {69, 82, 87, 86, 71, 86, 79, 83, 69, 74, 84, 67, 84, 75, 95, 65, 86, 79, 66, 78, 82, 71, 85, 87, 75, 89, 74, 70, 85, 97};
        double[] free3 = {81, 83, 99, 74, 85, 75, 63, 89, 80, 69, 73, 87, 85, 85, 65, 98, 89, 79, 96, 63, 92, 81, 95, 85, 76, 88, 73, 78, 74, 95};

        double loop1;//代表每个学生的总分
        double loop2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            loop1 = free1[i] + free2[i] + free3[i];
//            loop2 = (loop1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" +loop1);
//            System.out.println(name[i] + "的平均分为:" + loop2);
//        }


        double dai1 = 0, dai2 = 0;
        double[] qu = new double[30];
//        for (int i = 0; i < 30; i++) {
//            dai1 = free1[i] + free2[i] + free3[i];
//            dai2 = (dai1 * 1.0) / 3;
//            qu[i] =dai2;
//        }
//
//        for (int i = 0; i <qu.length - 1; i++) {
//            for (int j = 0; j <qu.length - i - 1; j++) {
//                if (qu[j] < qu[j + 1]) {
//                    double tep =qu[j];
//                    qu[j] =qu[j + 1];
//                    qu[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(qu[i]);
//        }


        double huawei1 = 0,huawei2 = 0, huawei3 = 0;//计算每门课的平均分
        double pingguo1 = 0,pingguo2 = 0,pingguo3 = 0;//计算每门课标准差
        double manguo1 = 0, manguo2 = 0, manguo3 = 0;//计算每门课中位数
        double sap = 0;
        for (int i = 0; i < free1.length; i++) {
            sap+=free1[i];
        }
        huawei1 = (sap*1.0)/30;
        System.out.println("分析化学的班级平均分为:"+ huawei1);
        double Sum = 0;
        for (int i = 0; i < free2.length; i++) {
            Sum+=free2[i];
        }
        huawei2 = (Sum*1.0)/30;
        System.out.println("线性代数的班级平均分为:"+huawei2);
        double sum = 0;
        for (int i = 0; i <free3.length; i++) {
            sum+=free3[i];
        }
        huawei3 = (sum*1.0)/30;
        System.out.println("有机化学的班级平均分为:"+huawei3);




        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <free1.length; i++) {
            c1+= (free1[i] - huawei1)*(free1[i] - huawei1);
        }
        pingguo1 = Math.sqrt(c1*1.0/30);
        System.out.println("分析化学的班级标准差为:"+pingguo1);

        for (int i = 0; i <free2.length; i++) {
            c2+= (free2[i] - huawei2)*(free2[i] -huawei2);
        }
        pingguo2 = Math.sqrt(c2*1.0/30);
        System.out.println("线性代数的班级标准差为:"+pingguo2);

        for (int i = 0; i <free3.length; i++) {
            c3+= (free3[i] - huawei3)*(free3[i] - huawei3);
        }
        pingguo3 = Math.sqrt(c3*1.0/30);
        System.out.println("有机化学的班级标准差为:"+pingguo3);
//////////
////////
////////
//        Arrays.sort(free1);
//        Arrays.sort(free2);
//        Arrays.sort(free3);
//        manguo1 =( free1[14]+free1[15])*1.0/2;
//        manguo2 =(free2[14]+ free2[15])*1.0/2;
//        manguo3 =( free3[14]+free3[15])*1.0/2;
//        System.out.println("分析化学的中位数为:"+  manguo1);
//        System.out.println("线性代数的中位数为:"+ manguo2);
//        System.out.println("有机化学的中位数为:"+ manguo3);





    }
}
